#include "server.h"
#include <stdio.h>
#include <string.h>

int handle_gets(ServerInfo* server, int client_index, const char* filename) {
    ClientInfo* client = &server->clients[client_index];
    Message response;

    // TODO: 实现文件发送逻辑

    response.type = MSG_TYPE_SUCCESS;
    response.length = snprintf(response.data, sizeof(response.data), "文件 %s 下载成功", filename);

    if (send_message(client->socket, &response) < 0) {
        perror("发送gets响应失败");
        return -1;
    }

    return 0;
}